home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Milan_1991 / Devcon91.4 / AppShell / Examples / Clipboard / clipiff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-01  |  4.6 KB  |  97 lines

  1. /*************************************************************************
  2.   *                                                                      *
  3.   *                            Preliminary                               *
  4.   *                        Amiga AppShell (tm)                           *
  5.   *                                                                      *
  6.   *  Copyright (c) 1990,1991 Commodore-Amiga, Inc. All Rights Reserved.  *
  7.   *                                                                      *
  8.   *   This software and information is proprietary, preliminary, and     *
  9.   *   subject to change without notice.                                  *
  10.   *                                                                      *
  11.   *                            DISCLAIMER                                *
  12.   *                                                                      *
  13.   *   THIS SOFTWARE IS PROVIDED "AS IS".                                 *
  14.   *   NO REPRESENTATIONS OR WARRANTIES ARE MADE WITH RESPECT TO THE      *
  15.   *   ACCURACY, RELIABILITY, PERFORMANCE, CURRENTNESS, OR OPERATION      *
  16.   *   OF THIS SOFTWARE, AND ALL USE IS AT YOUR OWN RISK.                 *
  17.   *   NEITHER COMMODORE NOR THE AUTHORS ASSUME ANY RESPONSIBILITY OR     *
  18.   *   LIABILITY WHATSOEVER WITH RESPECT TO YOUR USE OF THIS SOFTWARE.    *
  19.   *                                                                      *
  20.   *                          Non-Disclosure                              *
  21.   *                                                                      *
  22.   *   This information is not to be disclosed to any other company,      *
  23.   *   individual or party.  Discussion is to be restricted to CBM        *
  24.   *   approved discussion areas, such as the closed conferences on bix;  *
  25.   *   amiga.cert, amiga.com, amiga.beta/appshell.                        *
  26.   *                                                                      *
  27.   ************************************************************************
  28.   */
  29.  
  30. /* clipiff.h
  31.  * Header file for IFF clipboard routines.
  32.  * Copyright (C) 1990 Commodore-Amiga, Inc.
  33.  * Written by David N. Junod, 26-Aug-90
  34.  *
  35.  */
  36.  
  37. #include <exec/types.h>
  38. #include <exec/semaphores.h>
  39. #include <devices/clipboard.h>
  40. #include <libraries/iffparse.h>
  41. #include <utility/hooks.h>
  42.  
  43. #define    EXAMPLE    TRUE
  44. #define    MAX_UNITS    256
  45.  
  46. /* Our errors */
  47. #define    RC_EMPTY_CLIP        -1L    /* Clipboard is empty */
  48. #define    RC_NOT_ENOUGH_MEMORY    -4L    /* not enough memory */
  49. #define    RC_COULDNT_READ        -5L    /* Couldn't read a chunk */
  50. #define    RC_BAD_IFF        -8L    /* Clipboard contains a bad IFF */
  51. #define    RC_INVALID_TYPE        -9L    /* don't understand FORM type */
  52.  
  53. /* text stuff */
  54. #define    ID_FTXT        MAKE_ID('F','T','X','T')
  55. #define    ID_CHRS        MAKE_ID('C','H','R','S')
  56. #define    ID_AUTH        MAKE_ID('A','U','T','H')
  57. #define    ID_NAME        MAKE_ID('N','A','M','E')
  58.  
  59. /* not really a valid chunk type */
  60. #define    ID_SPACE    MAKE_ID(' ',' ',' ',' ')
  61.  
  62. /* Clip.c: function prototypes */
  63. struct ClipManager * __asm AllocClip (VOID);
  64. VOID __asm FreeClip (register __a1 struct ClipManager *cm);
  65. struct ClipBuff * __asm ReadClip (register __a1 struct ClipManager *,register __d0 LONG,register __d1 LONG );
  66. LONG __asm WriteClip (register __a1 struct ClipManager *,register __a2 struct ClipBuff *,register __d0 LONG);
  67. struct IFFHandle *__asm OpenClip (register __d0 LONG id);
  68. VOID __asm CloseClip (register __a1 struct IFFHandle *iff);
  69. VOID __asm FreeBuffer (register __a1 struct ClipBuff *buff);
  70. LONG __asm WriteChunk (register __a1 struct IFFHandle *iff , register __d0 LONG id, register __a2 STRPTR );
  71. struct ClipBuff * __asm ReadFTXT (register __a1 struct IFFHandle * iff );
  72. LONG __asm WriteFTXT (register __a1 struct IFFHandle *iff , register __a2 STRPTR buffer );
  73. LONG __asm QueryClip (register __a1 struct ClipManager *,register __d0 LONG,register __a2 ULONG *,register __a3 ULONG *);
  74. LONG __asm StartClipChangeHook (register __a1 struct ClipManager *,register __d0 LONG);
  75. LONG __asm StopClipChangeHook (register __a1 struct ClipManager *);
  76.  
  77. /* Return the contents of the clipboard */
  78. struct ClipBuff
  79. {
  80.     LONG b_ClipID;        /* Clip ID of assigned to contents */
  81.     LONG b_Type;        /* Content type of buffer */
  82.     VOID *b_Buff;        /* Pointer to the buffer area */
  83.     LONG b_Size;        /* Size of buffer (plus structure) */
  84. };
  85.  
  86. /* Clipboard manager */
  87. struct ClipManager
  88. {
  89.     struct IFFHandle *cm_Unit[MAX_UNITS];/* Handle for each possible unit */
  90.     struct ClipBuff *cm_Buff[MAX_UNITS];/* Buffer for each possible unit */
  91.     struct Hook cm_Hook;        /* Change hook (only one for me) */
  92.     LONG cm_HookUnit;            /* Unit hook was installed for */
  93. };
  94.  
  95. /* IFF parse library base */
  96. extern struct Library *IFFParseBase;
  97.